package com.rms.hkpc.presenter;

import com.google.gson.reflect.TypeToken;
import com.rms.hkpc.apiresult.ApiResultData;
import com.rms.hkpc.db.dto.ShortDto;
import com.rms.hkpc.model.AddHocModel;
import com.rms.hkpc.model.ComboModel;
import com.rms.hkpc.model.listener.OnResultListener;
import com.rms.hkpc.view.IFilterView;

import java.util.List;

public class FilterPresenter extends BasePresenter<IFilterView> {
    private ComboModel comboModel = new ComboModel();

    public void getStatus() {
        comboModel.combo("status", new OnResultListener() {
            @Override
            public void onSuccess(Object apiResult) {
                if (getView() != null) {
                    getView().onGetStatusSuccess((ApiResultData<List<ShortDto>>) apiResult);
                }
            }

            @Override
            public void onFails(Exception e) {
                if (getView() != null) {
                    getView().onGetStatusFails(e);
                }
            }
        }, new TypeToken<ApiResultData<List<ShortDto>>>() {
        }.getType());
    }
}
